package com.qfedu.dao.impl;

import com.qfedu.dao.UserDao;
import com.qfedu.pojo.User;

public class UserDaoImpl  extends BaseDao implements UserDao {
    @Override
    public User queryByPhoneAndPassword(String phone, String password) {
        String sql = "select phone,password,name,gender,idcode,address from bank_user where phone = ? and password = ?";
        return queryForOne(User.class, sql, phone, password);

    }

    @Override
    public int saveUser(User user) {
        String sql = "insert into bank_user (phone,password) values(?,?)";
        return update(sql,user.getPhone(),user.getPassword());
    }

    @Override
    public int newPassword(String phone, String password) {
        String sql="update bank_user set password=? where phone=?";
        return update(sql,password,phone);
    }

    @Override
    public int fullUser(String phone , String name, String gender, String idcode, String location) {
        String sql = "update bank_user set name = ?, gender=?, idcode = ?, address = ? where phone = ?";
        return update(sql,name,gender,idcode,location,phone);
    }
}
